{template 'common/header'}

<ul class="we7-page-tab">
	<li class="{if $do == 'front_download'}active{/if}"><a
			href="./index.php?c=phoneapp&a=front-download&do=front_download&version_id={$version_id}">APP设置</a></li>
	<li class="{if $do == 'domainset'}active{/if}"><a
			href="./index.php?c=phoneapp&a=front-download&do=getpackage&version_id={$version_id}&type=apk">下载AndroidAPP</a></li>
	<li class="{if $do == 'domainset'}active{/if}"><a
			href="./index.php?c=phoneapp&a=front-download&do=getpackage&version_id={$version_id}&type=ipa">下载IOSAPP</a></li>

</ul>

<div class="panel we7-panel">

	<div class="panel-heading">APP配置</div>
	<div class="panel-body we7-padding">
		<div class="form-group">
			<label class="control-label col-sm-2">选择Android apk文件</label>
			<div class="col-sm-10">
				<input type="file" class="form-control" accept=".apk" onchange="onApkSelect(event)"
					   name="file" value="" placeholder="没有可不传"/>
			</div>
		</div>
	</div>
</div>

<script>
	var siteinfo = '{php echo json_encode($siteinfo)}';
	function onApkSelect(event) {
		var file = event.target.files[0];
		require(['jszip', 'fileSaver'], function(JSZip, fileSaver){
			JSZip.loadAsync(file).then(function(zip){
				console.log(zip.comment);
				zip.generateAsync({comment: siteinfo,type:"blob"})
					.then(function (blob) {
						saveAs(blob, "配置.apk");
					});
			});
		});
	}
</script>
{template 'common/footer'}